package mtt.us.client.views.stundenplan;

import mtt.us.client.events.GetModelDataEvent;
import mtt.us.client.events.SetModelDataEvent;
import mtt.us.dto.StundenplanDTO;
import mtt.us.hmvcFramework.client.hmvc.model.GuiModel;
import hmvc4gwt.client.event.HmvcEvent;

public class StundenplanModel extends GuiModel {
	
	private StundenplanDTO stundenplan;
	
	public StundenplanModel(StundenplanDTO stundenplan) {
		setStundenplan(stundenplan);
	}

	public void doInit() {
		getController().register(GetModelDataEvent.class, this);
	}

	public void handleEvent(HmvcEvent event) {
		if (event instanceof GetModelDataEvent) {
			
			getController().fireLocalEvent(new SetModelDataEvent(getStundenplan()));
			
		}
	}

	private StundenplanDTO getStundenplan() {
		return stundenplan;
	}

	private void setStundenplan(StundenplanDTO stundenplan) {
		this.stundenplan = stundenplan;
	}
}
